package m2.attachement;

import m2.port.PortConfigFourni;
import m2.role.RoleRequis;
import m2.Element;

public class AttachementRRPF extends Element {
	protected RoleRequis roleRequis;
	protected PortConfigFourni portFourni;

	public AttachementRRPF(String name, RoleRequis roleRequis, PortConfigFourni portConfigFourni) {
		super(name);
		this.roleRequis = roleRequis;
		this.portFourni = portConfigFourni;
		
		this.addObserver(roleRequis);
		portConfigFourni.addObserver(this);
		
		
	}
	public RoleRequis getRoleRequis() {
		return roleRequis;
	}

	public void setRoleRequis(RoleRequis roleRequis) {
		this.deleteObserver(this.roleRequis);
		this.roleRequis = roleRequis;
		this.addObserver(this.roleRequis);
	}

	public PortConfigFourni getPortFourni() {
		return portFourni;
	}

	public void setPortFournis(PortConfigFourni portFourni) {
		portFourni.deleteObserver(this);
		this.portFourni = portFourni;
		this.portFourni.addObserver(this);
	}



	@Override
	public void update(Object o, Object arg) {
		System.out.println("\n\n"+name+ " "+ arg);
		notifyObservers(arg);
	}
}
